package com.example.test_demo.queue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
/**
 * BlockingQueue的Blocking说明自带锁功能，多线程能安全运行
 * @author Hasee
 *
 */
public class Test {
	public static void main(String[] args) {
		BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(100);
		Product product = new Product(queue);
		Consumer consumer = new Consumer(queue);
		new Thread(product).start();
		new Thread(product).start();
		new Thread(product).start();
		new Thread(consumer).start();
	}

}
